package com.zlsf.publish;


import com.zlsf.flv.FlvEncoder;
import io.vertx.core.Vertx;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public abstract class Publisher {

  protected Vertx vertx;
  protected String tag;

  public Publisher(String tag, Vertx vertx) {
    this.tag = tag;
    this.vertx = vertx;
  }

  public abstract void onVideoData(long timeoffset, byte[] data, FlvEncoder flvEncoder);

  public abstract void onAudioData(long timeoffset, byte[] data, FlvEncoder flvEncoder);


  public void close() {

  }

  public void send(byte[] message) {
    vertx.eventBus().publish(this.tag, message);
  }


}
